import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '用户ID',
    align:"center",
    dataIndex: 'userId'
   },
   {
    title: '奖励名称',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '奖励数量',
    align:"center",
    dataIndex: 'goldNum'
   },
   {
    title: '价格',
    align:"center",
    dataIndex: 'ecpm'
   },
   {
    title: '补贴金币',
    align:"center",
    dataIndex: 'subsidyNum'
   },
   {
    title: 'SDK名称',
    align:"center",
    dataIndex: 'sdkName'
   },
   {
    title: '代码位ID',
    align:"center",
    dataIndex: 'slotId'
   },
   {
    title: '多阶底价标签',
    align:"center",
    dataIndex: 'levelTag'
   },
   {
    title: '错误信息',
    align:"center",
    dataIndex: 'errorMsg'
   },
   {
    title: '请求唯一标识',
    align:"center",
    dataIndex: 'requestId'
   },
   {
    title: '渠道',
    align:"center",
    dataIndex: 'channel'
   },
   {
    title: '代码位类型',
    align:"center",
    dataIndex: 'ritType'
   },
   {
    title: '奖励时间',
    align:"center",
    dataIndex: 'bonusTime'
   },
   {
    title: '状态',
    align:"center",
    dataIndex: 'goldStatus'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '用户ID',
    field: 'userId',
    component: 'InputNumber',
  },
  {
    label: '奖励名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入奖励名称!'},
          ];
     },
  },
  {
    label: '奖励数量',
    field: 'goldNum',
    component: 'InputNumber',
  },
  {
    label: 'SDK名称',
    field: 'sdkName',
    component: 'Input',
  },
  {
    label: '代码位ID',
    field: 'slotId',
    component: 'Input',
  },
  {
    label: '多阶底价标签',
    field: 'levelTag',
    component: 'Input',
  },
  {
    label: '价格',
    field: 'ecpm',
    component: 'Input',
  },
  {
    label: '错误信息',
    field: 'errorMsg',
    component: 'Input',
  },
  {
    label: '请求唯一标识',
    field: 'requestId',
    component: 'Input',
  },
  {
    label: '渠道',
    field: 'channel',
    component: 'Input',
  },
  {
    label: '代码位类型',
    field: 'ritType',
    component: 'Input',
  },
  {
    label: '奖励时间',
    field: 'bonusTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入奖励时间!'},
          ];
     },
  },
  {
    label: '状态',
    field: 'goldStatus',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  userId: {title: '用户ID',order: 0,view: 'number', type: 'number',},
  name: {title: '奖励名称',order: 1,view: 'text', type: 'string',},
  goldNum: {title: '奖励数量',order: 2,view: 'number', type: 'number',},
  sdkName: {title: 'SDK名称',order: 3,view: 'text', type: 'string',},
  slotId: {title: '代码位ID',order: 4,view: 'text', type: 'string',},
  levelTag: {title: '多阶底价标签',order: 5,view: 'text', type: 'string',},
  ecpm: {title: '价格',order: 6,view: 'text', type: 'string',},
  errorMsg: {title: '错误信息',order: 7,view: 'text', type: 'string',},
  requestId: {title: '请求唯一标识',order: 8,view: 'text', type: 'string',},
  channel: {title: '渠道',order: 9,view: 'text', type: 'string',},
  ritType: {title: '代码位类型',order: 10,view: 'text', type: 'string',},
  bonusTime: {title: '奖励时间',order: 11,view: 'datetime', type: 'string',},
  goldStatus: {title: '状态',order: 12,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}